package day35_1456;

import java.util.HashSet;

/**
 * @ClassName Solution
 * @Description 超时
 * @Author clockTown
 * @Date 2021/6/13 20:13
 * @Version 1.0
 */
public class Solution1 {

    public int maxVowels(String s, int k) {
        HashSet<Character> set = new HashSet<>();
        set.add('a');
        set.add('e');
        set.add('i');
        set.add('o');
        set.add('u');

        int maxCount = 0;

        for (int i = 0; i < s.length() - k + 1; i++) {
            int count = 0;
            for (int j = i; j < i + k; j++) {
                if (set.contains(s.charAt(j))){
                    count++;
                }
            }
            maxCount = Math.max(maxCount, count);
        }

        return Math.min(maxCount, k);
    }

    public static void main(String[] args) {
//        String s = "abciiidef";
//        int k = 3;
//        String s = "aeiou";
//        int k = 2;
        String s = "leetcode";
        int k = 3;

        Solution1 sol = new Solution1();
        System.out.println(sol.maxVowels(s, k));
    }
}
